package com.work.sys.controller;

import cn.hutool.core.io.resource.ResourceUtil;
import com.work.common.annotation.PassToken;
import com.work.common.core.controller.BaseController;
import com.work.common.core.domain.AjaxResult;
import com.work.mp.domain.Login;
import com.work.mp.service.impl.LoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * 注册登录Controller
 *
 * @author lee
 * @date 2021-04-18
 */
@RestController
@RequestMapping("api/sys/login")
@Api(tags = {"注册登录接口"}, value = "注册登录")
public class LoginController extends BaseController {


    @Autowired
    private LoginService loginService;

    @PostMapping()
    @PassToken
    @ApiOperation(value = "用户登录", notes = "微信登录接口")
    public AjaxResult login(@ApiParam(value = "登录请求参数", required = true)
                            @RequestBody @Validated Login login) {
        return loginService.login(login);
    }
}
